using System;
using LoggingMagic.Injectors.Interfaces;
using LoggingMagic.LoggingParameters;
using Mono.Cecil;

namespace LoggingMagic.Injectors.StaticMethod
{
    internal class StaticMethodFactory : InjectorFactory
    {
        public StaticMethodFactory(ModuleDefinition module, IAssemblyResolver resolver, IMethodFinderParameters parameters)
            : base(module, resolver, parameters)
        {
        }

        private IInjector _withParameters;
        public override IInjector WithParameters
        {
            get
            {
                if (_withParameters == null)
                    _withParameters = new StaticMethodCallInjector(_module, MethodParametersToArray);

                return _withParameters;
            }
        }

        public override IInjector WithoutParameters
        {
            get { return WithParameters; }
        }
    }
}